import {request} from "./request";
import da from 'element-ui/src/locale/lang/da'

export function findAll(data) {
  return request({
    url: '/drug/findAll',
    data:
      {
        "pageNo": data.pageNo,
        "pageSize": data.pageSize
      },
      // data,
    method: 'post'
  })
}


export function findById(data) {
  return request({
    url: '/user/findOne',
    params:
      {
        id: data
      },
      // data,
    method: 'post'
  })
}

export function findByUsername(data) {
  return request({
    url: '/user/findByName',
    params:
      {
        realName: data
      },
      // data,
    method: 'post'
  })
}


export function add(user) {
  return request({
    url: '/drug/add',
    data:{
      name:user.name,
      price:user.price,
      purchaseprice:user.purchaseprice,
      num:user.num,
      productdate:user.productdate,
      qualityperiod:user.qualityperiod,
      supplyunit:user.supplyunit,
      productunit:user.productunit
    },
    // data,
    method: 'post'
  })
}

export function edit(data) {
  return request({
    url: '/dept/edit',
    data:
      {
        name: data.name,
        departId: data.departId
      },
    params: {
      departId: data.departId
    },
    // data,
    method: 'post'
  })
}

export function del(id) {
  return request({
    url: '/drug/del',
    params:
      {
        drugsid: id
      },
    // data,
    method: 'post'
  })
}

export function search(find1, find2) {

  return request({
    url: '/dept/search',
    params:
      {
        departId: find1,
        name: find2

      },
    // data,
    method: 'post'
  })
}

export function setNum(id, num) {

  return request({
    url: '/drug/setNum',
    params:
      {
        drugsid: id,
        num: num
      },
    // data,
    method: 'post'
  })
}



